<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 
String taskInstanceId = (String)request.getAttribute("taskInstanceId");
Set set = (Set)request.getAttribute("attchments");

%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<%=basePath%>style/1/css/formStyle.css">
    
<script>
function addrow(obj){
if(obj.delid==0){
 obj.value=" 删 除 ";
obj.title=" 删 除 ";
 obj.delid="1";
var temp = new String(Math.random()*10);
 var newTr = dataTable.insertRow(dataTable.rows.length);
var newTd2 = newTr.insertCell();
newTd2.align='left';
newTd2.colspan='2';
newTd2.innerHTML= "<input type='file' name='file"+temp+"' size='40' class='fileinput'  />&nbsp;<INPUT type='button' value=' 增 加 ' title=' 增 加 '  delid='0' onclick='addrow(this);' class='bg2'>";
  }else{
del(obj);
}}

function del(obj){
if(obj.parentElement.parentElement.rowIndex!=undefined)
{
	document.getElementById("dataTable").deleteRow(obj.parentElement.parentElement.rowIndex);
}
}
function showAttachTemplate(formLoginId,actionId){
	var url="http://127.0.0.1:88/dcpm/tableform/formAction.do?type=attachList&formLoginId="+formLoginId+"&actionId="+actionId;
	openwindow(url,'400','300','');
}
function delAttach(attName,formAttId,formId){
	if(confirm('确认删除［'+attName+'］附件？')){
	var url="http://127.0.0.1:88/dcpm/tableform/formAction.do?type=delFormAtt&attId="+formAttId + "&formId="+formId;
	document.form1.action='http://127.0.0.1:88/dcpm/tableform/formAction.do?type=delFormAtt&formAttachId='+formAttId+'&formId='+formId+'&actionId=52';
	document.form1.submit();
	}
}
function submitForm(){
    form1.action = "<%=path%>/control/upload.do?taskInstanceId=<%=taskInstanceId%>"; 
    document.form1.submit();
}
</script>
<title></title>
<link href="<%=basePath%>style/1/css/style.css" rel="stylesheet" type="text/css">  
</head>
<body>
<form name="form1" enctype="multipart/form-data"  action=""   method="post">  
<br>
<br>
<table width="90%"   border="0" align="center" cellpadding="0" cellspacing="0" class="bg1">
       <tr>
         <td width="90%" height="18"   ><div align="center"><h3>附件上传</h3></div></td> 
       </tr>
       
</table>
 
 <table width="90%"   border="0" align="center" cellpadding="0" cellspacing="0" class="bg1">
       <tr>
         <td width="90%" height="18"   ><div align="left"><h3>已有附件</h3></div></td> 
       </tr> 
       <%if(null != set){ 
            Iterator iter  = set.iterator();
            while(iter.hasNext()){
               BpmAttachment att = (BpmAttachment)iter.next();
          %>
       <tr>
         <td width="90%" height="18"   ><%=att.getFileName() %></div></td> 
       </tr> 
       <%}} %>
</table>
<table width="90%" id="dataTable" border="0" align="center" cellpadding="0" cellspacing="0" class="bg1"> 
       <tr> 
		<td colspan=2 class="bg2" nowrap > 
		<input type="file" name="file1"    size="40" class="fileinput" > 
		<INPUT type="button" value=" 增加 " delid="0" title="添加" class="bg2"  onclick="addrow(this);"> </td>
		</tr>
		 
</table>
<table width="90%"  border="1" align="center" cellpadding="0" cellspacing="0" class="bg1"> 
        
		 <tr> 
		<td colspan=2 class="bg2" align="center" nowrap> <input type="button" value="提交" onclick="submitForm()">
		  </td>
		</tr>
</table>
 
</form>
</body>
</html>
